<?php

use kartik\helpers\Html;
use kartik\grid\GridView;

/* @var $this yii\web\View */
/* @var $searchModel backend\modules\credit\models\CreditOrderSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = '征信订单列表';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="credit-order-index">

    <h1><?= Html::encode($this->title) ?></h1>
    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>

    <p>
        <?php // echo Html::a('Create Credit Order', ['create'], ['class' => 'btn btn-success']) ?>
    </p>
    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
            'id',
            'custom_id',
            'custname',
            [
                'class' => \common\components\grid\KEnumColumn::className(),
                'attribute' => 'idtype',
                'enum' => \common\models\CreditOrder::getIdtype(),
            ],
            'idno',
            [
                'class' => \common\components\grid\KEnumColumn::className(),
                'attribute' => 'relation',
                'enum' => \common\models\CreditOrder::getRelationType(),
            ],
            [
                'label' => '银行',
                'value' => 'bank.name',
            ],
            [
                'label' => '担保公司网店',
                'value' => 'guaranteeCompanyDotSite.name',
            ],
            'status',
            [
                'class' => \kartik\grid\ExpandRowColumn::className(),
                'width' => '50px',
                'value' => function ($model, $key, $index, $column) {
                    return \kartik\grid\GridView::ROW_COLLAPSED;
                },
                'detail' => function ($model, $key, $index, $column) {
                    return Yii::$app->controller->renderPartial('detail', ['model'=>$model, 'id'=>$key]);
                },
                'headerOptions' => ['class' => 'kartik-sheet-style'],
                'expandOneOnly' => true,
                'pageSummary'=>'总计',//可以是字符串，当为true时，自动合计
            ],
            'serialize_data:ntext',

            ['class' => 'yii\grid\ActionColumn'],
        ],
    ]); ?>
</div>
